<!-- 选择事件 -->

<template>
  <FormSlot label="关联事件">
    <div v-if="one.eventId">
      <BtnText :title="one.eventId" @click="windowDetail(one.eventId)" />
      <BtnText title="清除" @click="toClear" />
    </div>

    <div v-else>
      <BtnPrimary title="选择" @click="toOpen" />
    </div>
  </FormSlot>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import mixDetailToTable from '@admin/components/detail/mixDetailToTable'

// ============================== 导出组件 ============================== //

export default {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'MyEvent',

  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [CORE.mixWeb(), mixDetailToTable('event', 'DetailEmergencyEvent')],

  /**
   * 本地方法 (轻量重要在前)
   */
  methods: {
    /**
     * 弹窗
     */
    toOpen() {
      const { one: { eventId } } = this
      this.event_openEdit({ id: eventId })
    },

    /**
     * 清除
     */
    toClear() {
      this.one.eventId = ''
    },
  },
}
</script>
